package org.patterns.behavior.mediator;


public class Client {
	public static void main(String[] args) {
		/*
        //定义中介者对象
		ConcreteMediator mediator = new ConcreteMediator();
		
        //定义同事对象
		Button addBtn = new Button();
		List list = new List();
	    ComboBox comBox = new ComboBox();
	    TextBox txtBox = new TextBox();

		addBtn.setMediator(mediator);
		list.setMediator(mediator);
		comBox.setMediator(mediator);
		txtBox.setMediator(mediator);

		mediator.addButton = addBtn;
		mediator.list = list;
		mediator.comBox = comBox;
		mediator.nameTextBox = txtBox;
		
		addBtn.changed();
		System.out.println("-----------------------------");
		list.changed();
		*/
		
	    //用新增具体中介者定义中介者对象
		SubConcreteMediator	mediator = new SubConcreteMediator();
		
		Button addBtn = new Button();
		List list = new List();
		ComboBox comBox = new ComboBox();
		TextBox txtBox = new TextBox();
		Label label = new Label();

		addBtn.setMediator(mediator);
		list.setMediator(mediator);
		comBox.setMediator(mediator);
		txtBox.setMediator(mediator);
		label.setMediator(mediator);
			
		mediator.addButton = addBtn;
		mediator.list = list;
		mediator.comBox = comBox;
		mediator.nameTextBox = txtBox;
		mediator.label = label;
				
		addBtn.changed();
		System.out.println("-----------------------------");
		list.changed();
	}
}
